package com.kaikeba.util;

import com.kaikeba.bean.Express;
import com.kaikeba.bean.UserExpress;

import javax.servlet.http.HttpSession;

public class UserUtil {
    public static String getUserName(HttpSession session){
        return (String) session.getAttribute("adminUserName");
    }
    public static String getUserPhone(HttpSession session){
        // TODO : 还没有编写柜子端,未存储任何的录入人信息
        return "18888888888";
    }

    public static String getLoginSms(HttpSession session,String userPhone){
        return (String) session.getAttribute(userPhone);
    }

    public static void setLoginSms(HttpSession session,String userPhone,String code){
        session.setAttribute(userPhone,code);
    }

    public static void setWxUser(HttpSession session, UserExpress user){
        session.setAttribute("wxUser",user);
    }

    public static UserExpress getWxUser(HttpSession session){
        return (UserExpress) session.getAttribute("wxUser");
    }

    public static void setStatus(HttpSession session,int status){
        //存入值判断  登陆的是用户还是快递员  0是用户  1是快递员
        session.setAttribute("flagStatus",status);
    }

    public static int getStatus(HttpSession session){
        return (int) session.getAttribute("flagStatus");
    }

    public static void setExpress(HttpSession session, Express e){
        session.setAttribute("express",e);
    }

    public static Express getExpress(HttpSession session){
        return (Express) session.getAttribute("express");
    }
}
